<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="format-detection" content="telephone=no" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>指纹考勤</title>
		<link rel="stylesheet" href="//cdn.bootcss.com/weui/1.1.1/style/weui.min.css">
		<link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/1.0.1/css/jquery-weui.min.css">
		<link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
		<link rel="stylesheet" type="text/css" href="../css/kaoqin/check.css"/>
		<style type="text/css">
			.weui-cells{
				margin-top: 0;
			}
		</style>
	</head>
	<body>
		<div id="check">
			<div class="content">
				学期汇总：<input type="text" id="Semester" v-model="Semester" readonly onfocus="this.blur();">
			</div>
			<div class="fenge"></div>
			<div class="form">
				<div class="top">
					<div class="left">
						<div class="con">
							<div class="img_con"><img src="../img/kaoqin/yindao.png"/></div>
							<div class="con_con">
								<p>应到节数</p>
								<p>{{num1}}</p>
							</div>
						</div>
					</div>
					<div class="right">
						<div class="con">
							<div class="img_con"><img src="../img/kaoqin/shidao.png"/></div>
							<div class="con_con">
								<p>实到节数</p>
								<p>{{num2}}</p>
							</div>
						</div>
					</div>
				</div>
				<div class="top">
					<div class="left">
						<div class="con">
							<div class="img_con"><img src="../img/kaoqin/kuangke.png"/></div>
							<div class="con_con">
								<p>旷课节数</p>
								<p>{{num3}}</p>
							</div>
						</div>
					</div>
					<div class="right">
						<div class="con">
							<div class="img_con"><img src="../img/kaoqin/chidao.png"/></div>
							<div class="con_con">
								<p>迟到节数</p>
								<p>{{num4}}</p>
							</div>
						</div>
					</div>
				</div>
				
			</div>
			<div class="weui-cells">
			  <a @click="Goto1()" class="weui-cell weui-cell_access" href="javascript:;">
			    <div class="weui-cell__bd">
			      <p>旷课列表</p>
			    </div>
			    <div class="weui-cell__ft">
			    </div>
			  </a>
			  <a @click="Goto2()" class="weui-cell weui-cell_access" href="javascript:;">
			    <div class="weui-cell__bd">
			      <p>迟到列表</p>
			    </div>
			    <div class="weui-cell__ft">
			    </div>
			  </a>
			</div>
		</div>
	</body>
	<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script src="https://res.wx.qq.com/open/libs/weuijs/1.0.0/weui.min.js"></script>
	<script src="../js/vue-resource.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../js/common/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="https://unpkg.com/mint-ui/lib/index.js"></script>
	<script type="text/javascript">
		var vm = new Vue({
			el:"#check",
			data:{
				Semester:"请选择",
				num:"",
				num1:"0",
				num2:"0",
				num3:"0",
				num4:"0",
				Number:null,
				time:"",
				semeter:"",
				number:""
			},
			created:function(){
				var _self = this;
				_self.num = localStorage.getItem("number");
				var sem = localStorage.getItem("sem");
				var time = localStorage.getItem("time");
				console.log("sem:"+sem);
				console.log("time:" + time);
				console.log(_self.num);
				if(sem = "" || time = ""){
					console.log("第一次进来!");
					
				}else{
					var url = kserver_url + "a/zhtj/kckqjl/getCourse?number=" + _self.num +"&semeyear=" + time + "&semester=" + sem;
					console.log(url);
					_self.$http.get(url).then(function(res){
						if(res.status == 200){
							_self.num1 = res.body.data.all;
							_self.num2 = res.body.data.all;
							_self.num3 = res.body.data.kuangkenum;
							_self.num4 = res.body.data.chidaonum;
						}
					});
				}
			},
			watch:{
				Number:function(New,Old){
					var _self = this;
					console.log(New);
//					15010057		
					var aa = 0;
					console.log(_self.num);
					if(New == 0){
						_self.time = 20162017;
						_self.semeter = 1;
						console.log(_self.time);
						console.log(_self.semeter);
						var url = kserver_url + "a/zhtj/kckqjl/getCourse?number=" + _self.num +"&semeyear=" + _self.time + "&semester=" + _self.semeter;
						console.log(url);
						_self.$http.get(url).then(function(res){
							console.log(res)
						})
					}else if(New == 1){
						_self.time = 20162017;
						_self.semeter = 2;
						console.log(_self.time);
						console.log(_self.semeter);
						var url =kserver_url + "a/zhtj/kckqjl/getCourse?number=" + _self.num +"&semeyear=" + _self.time + "&semester=" + _self.semeter;
						console.log(url);
						_self.$http.get(url).then(function(res){
							console.log(res)
						})
					}else if(New == 2){
						_self.time = 20172018;
						_self.semeter = 1;
						console.log(_self.time);
						console.log(_self.semeter);
						var url = kserver_url + "a/zhtj/kckqjl/getCourse?number=" + _self.num +"&semeyear=" + _self.time + "&semester=" + _self.semeter;
						console.log(url);
						_self.$http.get(url).then(function(res){
							if(res.status == 200){
								_self.num1 = res.body.data.all;
								_self.num2 = res.body.data.all;
								_self.num3 = res.body.data.kuangkenum;
								_self.num4 = res.body.data.chidaonum;
							}
						});
					}
				}
			},
			methods:{
				Goto1:function(){
					var _self = this;
					var num = _self.num ;
					var time1 = _self.time;
					var set = _self.semeter;
					if(_self.num3 == 0){
						this.$toast({
						  message: '没有旷课记录',
						  position: 'middle'
						});
						return;
					}
					localStorage.setItem("time1",time1);
					localStorage.setItem("set",set);
					localStorage.setItem("num",num);
					location.href = "Absenteeism.html";
				},
				Goto2:function(){
					var _self = this;
					var num = _self.num ;
					var time1 = _self.time;
					var set = _self.semeter;
					if(_self.num4 == 0){
						this.$toast({
						  message: '没有迟到记录',
						  position: 'middle'
						});
						return;
					}
					localStorage.setItem("time1",time1);
					localStorage.setItem("set",set);
					localStorage.setItem("num",num);
					location.href = "late.html";
				}
			}
		})
		
		var Semester = document.getElementById("Semester");
				var isValu = [{
					label:"2016-2017第一学期",
					value:0,
					time:20162017,
					semeter:1
				},{
					label:"2016-2017第二学期",
					value:1,
					time:20162017,
					semeter:2
				},{
					label:"2017-2018第一学期",
					value:2,
					time:20172018,
					semeter:1
				}]
				Semester.addEventListener("click",function(event){
					weui.picker(isValu,{
						onChange:function(result){
							
						},
						onConfirm:function(result){
//							Semester.vlaue = isValu[parseInt(result)].label;
							vm.Semester = isValu[parseInt(result)].label;
							vm.$data.Number = result[0];
							var sem = isValu[parseInt(result)].semeter;
							var time = isValu[parseInt(result)].time;
							localStorage.setItem("time",time);
							localStorage.setItem("sem",sem);
						}
					})
				},false)
	</script>
</html>
